package com.itheima.Controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.GenderOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    //    接口描述：统计各个职位的员工人数
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("查询员工数据统计结果");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);


    }

    //统计员工性别信息
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        log.info("查询员工性别数据统计结果");
        List<GenderOption> genderOption = reportService.getEmpGenderData();
        return Result.success(genderOption);
    }

    /**
     * 统计学员的学历信息
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("统计学员的学历信息");
        List<Map> dataList = reportService.getStutDegreeData();
        return Result.success(dataList);
    }

    /**
     * 统计每一个班级的人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        log.info("统计每一个班级的人数");
        ClazzOption clazzOption = reportService.getStutCountData();
        return Result.success(clazzOption);
    }

}
